#!/bin/bash
#apt update
#apt install gcc gdb
####################################################################
##change apt source to cn
#disable warngin:tty

echo 'tty -s && mesg n || true' > ~/.profile

cat >> ~/.bashrc << EOF
if [ -f ~/.profile ] ; then 
	. ~/.profile 
fi
EOF
#sed -i 's/mesg/tty -s \&\& mesg/g' ~/.profile

apt-get update 
apt-get install -y apt-utils

cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF

apt-get update 
apt-get upgrade -y

apt-get install -y wget curl psmisc build-essential autotools-dev sudo  \
	xz-utils dialog net-tools netcat tcpdump ethtool nload  traceroute tcptraceroute iproute2 \
	libicu-dev autoconf automake libtool \
	vim git gcc g++ gdb clang-4.0 clang-tools-4.0 python-lldb-4.0  liblldb-4.0-dev \
	libclang-4.0-dev lldb-4.0 liblldb-4.0  \
	cmake doxygen libbz2-dev libssl-dev libgmp3-dev libpython2.7-dev python2.7-dev graphviz \
	python3 python3-pip python3-dev \
	inetutils-ping inetutils-telnet inetutils-ftp \
	openssh-client openssh-server  openssh-sftp-server  nginx


apt-get clean
apt-get autoclean
rm -rf /var/lib/apt/lists/*

git config --global core.editor vim
git config --global user.name "vi"
git config --global user.email "vi@docker.com"

mkdir ~/run
mkdir ~/git/


#cd ~/git && git clone git://yuanji.tech/tool_sh.git && cd tool_sh && ./install.sh
#cd ~/git && git clone git://yuanji.tech/p2pcpp.git && cd p2pcpp/shell && ./install_dependence.sh
#cd ~/git && git clone git://yuanji.tech/chain.git 
#cd ~/git && git clone git://yuanji.tech/scf-core.git && cd scf-core && git branch --track vi origin/vi && git checkout vi && ./ultrainio_build_cn.sh

rm -rf ~/git
rm  ~/install_base.sh
pwd
echo "-- info, image build succeed."




